import { deleteRole } from "@/api/system/role";

export default self => {
  return [
    {
      id: "",
      label: "编辑",
      methods: scope => {
        self.openAddOrEditModel(scope.row,"edit");
      }
    },
    {
      id: "",
      label: "删除",
      class: "neu-delete-plain",
      // isShow: scope => scope.row.mntFlag === "1",
      methods: scope => {
        Utils.$confirm({
          type: "warning",
          title: "删除",
          message: "确认删除该角色信息吗？",
          confirm: async () => {

            const id = scope.row.id;
            await deleteRole(id).then(data  => {
              if (data.flag) {
                self.$notify.success({
                  title: "成功",
                  message: data.message
                });
                self.search();
              } else {
                self.$notify.error({
                  title: "失败",
                  message: data.message
                });
              }
            });
          }
        });
      }
    }
  ];
};
